﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using BusinessObjects.BO_GetObjects;
using DigiLib;
using System.Xml;



public partial class Controls_Contact : System.Web.UI.UserControl
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            lblMessage.Text = "";
            LoadLienHe();
        }
    }
    protected void btnSend_Click(object sender, EventArgs e)
    {
        try
        {
            String Name = Request["name"].ToString().Trim();
            String Email = Request["email"].ToString().Trim();
            String Phone = Request["phone"].ToString().Trim();
            String Address = Request["address"].ToString().Trim();
            String Content = Request["comment"].ToString().Trim();


            string result = BO_portal_contact_us.Insert(Name, Email, "", Phone, "", Address, "", Content, false, DateTime.Now, true);
            if (true)
            {
                lblMessage.Text = "Gửi liên hệ không thành công";
            }
            else
            {
                lblMessage.Text = "Gửi liên hệ thành công";
            }
        }
        catch (Exception)
        {

            throw;
        }
        
    }
    protected void LoadLienHe()
    {

        try
        {
            Setting.statistic(this.Context);
            string fname = Server.MapPath(Setting.PathFooter);
            XmlDocument doc = new XmlDocument();
            doc.Load(fname);
            XmlNode root = doc.DocumentElement;
            XmlNodeList list = root.ChildNodes;
            noidungfooter.InnerHtml = Server.HtmlDecode(list.Item(0).InnerText);
        }
        catch { }

    }
}